package com.agency8x.sqls;

public class AgencySqls implements ModelSqlInterface {
	public static final AgencySqls me=new AgencySqls();

	private String table="t_user";
	
	@Override
	public String getTableName() {
		return table;
	}

	public String getPagingSelectSql() {
		return "select a.user_id,a.nickname,a.user_status,a.regist_date,e.is_agent_time,b.child1_agent_count ,c.blance,d.income_amount_today,d.income_amount_month,"
				+ "d.income_amount_year,d.withdraw_amount_total,d.recharge_amount_total,d.income_amount_total,d.withdraw_amount_today,d.recharge_amount_today ,a.top_agent_id ";
	}

	@Override
	public String getPagingExceptSelectSql() {
		return "from t_user a left join t_user_agent_statistics b on a.user_id =b.user_id "
				+ "left join t_user_finance_account c on a.user_id =c.user_id "
				+ "left join t_user_finance_statistics d on a.user_id = d.user_id "
				+ "left join t_user_agent e on a.user_id = e.user_id "
				+ "where a.is_agent = 1 ";
	}

	public String getFindByIdSql() {
		return "select u.*, agt.is_agent_time, acc.blance, acc.frozen_blance from t_user u left join t_user_agent agt on u.user_id=agt.user_id left join dbo.t_user_finance_account acc on u.user_id=acc.user_id where u.user_id = ?";
	}
	
}
